package com.sheng;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;

import java.net.InetAddress;

/**
 * @Author: 王胜
 * @Date 2022/11/19 13:54
 */
@SpringBootApplication
@ServletComponentScan
@Slf4j
public class Application implements ApplicationRunner {

    @Value("${server.port}")
    private String port;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        String ip = InetAddress.getLocalHost().getHostAddress();
        log.info("项目启动完成.............................");
        log.info("swagger2访问地址：http://{}:{}/doc.html", "localhost", port);
        log.info("swagger2访问地址：http://{}:{}/doc.html", ip, port);
        log.info("druid监控界面地址：http://{}:{}/druid/sql.html", "localhost", port);
        log.info("druid监控界面地址：http://{}:{}/druid/sql.html", ip, port);
    }
}
